package flc.ast.adapter;

import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;
import stark.common.basic.view.container.StkLinearLayout;
import stark.common.basic.view.container.StkRelativeLayout;

public class SpliceAdapter extends StkProviderMultiAdapter<Integer> {

    public SpliceAdapter() {
        addItemProvider(new StkSingleSpanProvider<>(150));
        addItemProvider(new SpliceProvider());
    }


    private class SpliceProvider extends BaseItemProvider<Integer> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_splice;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, Integer bean) {
            baseViewHolder.setImageResource(R.id.ivSpliceItemImg,bean);
            if (baseViewHolder.getBindingAdapterPosition()==0){
                StkLinearLayout view=baseViewHolder.getView(R.id.llSpliceItem);
                ViewGroup.MarginLayoutParams params = new ViewGroup.MarginLayoutParams(view.getLayoutParams());
                params.setMargins(55,0,55,0);
                view.setLayoutParams(params);
            }
        }
    }
}
